package com.micro.ai.files.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 文件操作日志实体类
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName("file_operations")
@Schema(description = "文件操作日志信息")
public class FileOperation implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID（自增）
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "操作ID", example = "1")
    private Long id;

    /**
     * 租户ID
     */
    @Schema(description = "租户ID", example = "tenant_001")
    private String tenantId;

    /**
     * 文件ID
     */
    @Schema(description = "文件ID", example = "file_123")
    private String fileId;

    /**
     * 操作类型：upload-上传, download-下载, delete-删除, rename-重命名, move-移动, copy-复制, share-分享, preview-预览, restore-恢复, update-更新
     */
    @Schema(description = "操作类型", example = "upload", allowableValues = {"upload", "download", "delete", "rename", "move", "copy", "share", "preview", "restore", "update"})
    private String operationType;

    /**
     * 操作人ID
     */
    @Schema(description = "操作人ID", example = "user_001")
    private String operatorId;

    /**
     * 操作人IP
     */
    @Schema(description = "操作人IP", example = "192.168.1.1")
    private String operatorIp;

    /**
     * 用户代理
     */
    @Schema(description = "用户代理", example = "Mozilla/5.0...")
    private String userAgent;

    /**
     * 操作时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "操作时间", example = "2025-01-01 00:00:00")
    private LocalDateTime operationTime;

    /**
     * 操作详情（JSON），如原路径、新路径等
     */
    @Schema(description = "操作详情（JSON）", example = "{\"oldPath\":\"/old\",\"newPath\":\"/new\"}")
    private String details;
}

